import htm from "htm";

/**
 * Virtual node structure.
 * 
 * @alpha
 */
export class VNode {
  constructor(
    readonly type: string,
    readonly props: Record<string, any>,
    readonly children: VNode[]
  ) {}
}

/**
 * The SVG tag that renders the given string template to virtual nodes.
 * 
 * @public
 */
export const svg = htm.bind((type, props, ...children) => {
  return new VNode(type, props, children);
});
